Conventionally, a game apparatus is known that captures an image of an object in a virtual space using a virtual camera and displays the image on a display device (e.g., Japanese Patent Laid-Open Publication Nos. 2002-163676 and 2001-149643). In the game apparatus disclosed in Japanese Patent Laid-Open Publication No. 2002-163676, a determination boundary box including a plurality of objects in a game space is calculated, and it is determined whether or not the determination boundary box falls within the screen in accordance with settings at that time of the virtual camera. When the settings of the virtual camera do not cause the determination boundary box to fall within the screen, at least one of a position, an orientation, and an angle of view of the virtual camera is changed so as to cause the determination boundary box to fall within the screen.
Also, in the game apparatus disclosed in Japanese Patent Laid-Open Publication No. 2001-149643, when an enemy character exists within a predetermined distance range from a position of a player character, a virtual camera control means is used to calculate a position and an orientation of the virtual camera that allow the player character to follow the enemy character and exist within the sight of the player, based on positions and orientations of an enemy object and a player object. Thereafter, the virtual camera is set, and an image of a sight viewed from the virtual camera is generated.
However, game apparatuses as described above conventionally have the following problems. In the process disclosed in each of the aforementioned patent documents, the position and the angle of view of the virtual camera are set with reference to the position or the like of an object in the virtual space. Specifically, the position or the like of the virtual camera is determined so that predetermined objects (e.g., both a player object and an enemy object) fall within the single screen. For example, it is assumed that an image of three cubic models is captured by the virtual camera and is displayed. Firstly, it is assumed that the virtual space and the real space have the same scale (the size of a cube in the real space and the size of a cubic model in the virtual space have a ratio of 1:1). As shown in FIG. 18A, it is also assumed that the position and the angle of view of the virtual camera are set so that all the three cubes are displayed within the screen. In FIG. 18A, a distance from the cubes to the virtual camera is assumed to be 1 m. As a result, all the three cubes are displayed on the screen as shown in FIG. 18B.
On the other hand, it is assumed that, in the real space, the player is located a distance away from a television having the screen as shown in FIG. 19. In FIG. 19, the distance between the television and the player is assumed to be 3 m. It is also assumed that the cubes actually exist in the real space. For example, the screen of the television is considered as a “window”, and the cubes are assumed to actually exist immediately behind the window. Specifically, FIG. 20 shows a positional relationship among the player, the television and the cubes when it is assumed that the cubes actually exist. In this case, a region (visual angle) that is viewed by the player through a window (television) is a region that is indicated by a dashed line 901 of FIG. 20. Therefore, a region 902 is a region that is normally not viewed from the player. In other words, the player can normally view only one middle cube that is located behind the window (television).
However, even in the case of a positional relationship as shown in FIG. 20, the three cubes are displayed on the screen as show in FIG. 18B (i.e., the three cubes are seen in the window). When the three cubes apparently fall within the single screen as viewed from the position of the player of FIG. 20, this displayed image of the three cubes is unnatural as compared to an image that would be seen if the cubes were in the real space. Therefore, when it is assumed that the three cubes actually exist behind the television in the real space, the displayed image is unnatural for an image that would be seen from the position of the player. Such an unnatural image causes the player to feel that something is wrong, i.e., the image is less realistic.
Therefore, an object certain example embodiments provide a computer readable recording medium recording an image processing program and an image processing apparatus capable of achieving a more realistic expression.
Certain example embodiments have the following features to attain the object mentioned above. Note that reference numerals, additional descriptions and the like inside parentheses in this section indicate correspondence to embodiments described below for the sake of easy understanding, and do not limit the present invention.
A first aspect of certain example embodiments is directed to a computer readable recording medium recording an image processing program executable by a computer of an image processing apparatus for outputting an image of a virtual space captured by a virtual camera to a display device (2). The program causes the computer to function as a displayed region size obtaining means (S1), a distance obtaining means (S5), and a virtual camera setting means (S6 to S8). The displayed region size obtaining means obtains displayed region size data indicating a size of a screen of the display device, or a size of a region in which the image of the virtual space is displayed on the screen. The distance obtaining means obtains distance data indicating a distance between a user and the display device. The virtual camera setting means sets a position and an angle of view of the virtual camera in the virtual space based on the displayed region size data and the distance data.
Thus, according to the first aspect, it is possible to prevent the image of the virtual space displayed on the display device from being unnatural for an image that is seen from a position of the player. As a result, a more realistic virtual space can be displayed as if it existed at a position where the display device is located (or in the display device). Thereby, it is possible to substantially prevent the user from feeling that something is wrong.
In a second aspect based on the first aspect, the displayed region size data includes data indicating a width in a predetermined first direction and a width in a second direction perpendicular to the first direction, of the screen of the display device or the region in which the image of the virtual space is displayed on the screen. The virtual camera setting means sets a horizontal angle of view and a vertical angle of view of the virtual camera, based on the first-direction width and the second-direction width included in the displayed region size data.
Thus, according to the second aspect, the horizontal angle of view and the vertical angle of view of the virtual camera are determined based on a vertical width and a horizontal width on the screen of the region in which the image of the virtual space is displayed. Thereby, a more realistic image can be displayed.
In a third aspect based on the first aspect, the displayed region size data includes data indicating a width in a predetermined first direction and a width in a second direction perpendicular to the first direction, of the screen of the display device or the region in which the image of the virtual space is displayed on the screen. The virtual camera setting means sets a horizontal angle of view and a vertical angle of view of the virtual camera, based on the first-direction width or the second-direction width included in the displayed region size data.
Thus, according to the third aspect, the horizontal angle of view and the vertical angle of view of the virtual camera are determined based on a vertical width or a horizontal width on the screen of the region in which the image of the virtual space is displayed. Thereby, a more realistic image can be displayed.
In a fourth aspect based on the second aspect, the virtual camera setting means sets the horizontal angle of view and/or the vertical angle of view of the virtual camera to be larger as the first-direction width and/or the second-direction width increase.
In a fifth aspect based on the third aspect, the virtual camera setting means sets the horizontal angle of view and/or the vertical angle of view of the virtual camera to be larger as the first-direction width and/or the second-direction width increase.
Thus, according to the fourth and fifth aspects, the angle of view of the virtual camera can be adjusted, depending on a size of the screen of the display device or the region in which the image of the virtual space is displayed. Thereby, a more realistic image can be displayed.
In a sixth aspect based on the second aspect, the virtual camera setting means sets the horizontal angle of view and/or the vertical angle of view to be smaller as the distance indicated by the distance data increases.
In a seventh aspect based on the third aspect, the virtual camera setting means sets the horizontal angle of view and/or the vertical angle of view to be smaller as the distance indicated by the distance data increases.
Thus, according to the sixth and seventh aspects, even when the user himself or herself moves, so that the distance between the user and the display device is changed, a highly realistic image corresponding to the distance can be displayed.
In an eighth aspect based on the first aspect, the virtual camera setting means sets the angle of view of the virtual camera to be larger as the screen of the display device or the region in which the image of the virtual space is displayed on the screen increases.
Thus, according to the eighth aspect, the angle of view of the virtual camera can be adjusted, depending on a size of the screen of the display device or the region in which the image of the virtual space is displayed. Thereby, a more realistic image can be displayed.
In a ninth aspect based on the first aspect, the virtual camera setting means sets the angle of view to be smaller as the distance indicated by the distance data increases.
Thus, according to the ninth aspect, even when the user himself or herself moves, so that the distance between the user and the display device is changed, a highly realistic image corresponding to the distance can be displayed.
In a tenth aspect based on the first aspect, the distance obtaining means includes a captured image data obtaining means (S5) and a distance calculating means (S5). The captured image data obtaining means obtains captured image data output from an input device (7) including an image capturing means for capturing an image of at least one imaging subject which is placed in a vicinity of the display device. The distance calculating means calculates a distance between the input device and the imaging subject as a distance between the user and the display device, based on the imaging subject shown in the captured image indicated by the captured image data.
Thus, according to the tenth aspect, the distance can be obtained more accurately, so that a more realistic image can be displayed.
In an eleventh aspect based on the tenth aspect, the distance calculating means calculates the distance between the input device and the imaging subject based on a size of the imaging subject shown in the captured image.
In a twelfth aspect based on the eleventh aspect, the distance between the input device and the imaging subject that is calculated by the distance calculating means has a smaller value as the size of the imaging subject shown in the captured image increases.
In a thirteenth aspect based on the tenth aspect, the distance calculating means calculates the distance between the input device and the imaging subject based on a distance between a plurality of imaging subjects shown in the captured image.
In a fourteenth aspect based on the thirteenth aspect, the distance between the input device and the imaging subject that is calculated by the distance calculating means has a smaller value as a distance between a plurality of imaging subjects increases.
Thus, according to the eleventh to fourteenth aspects, the distance between the imaging subject and the input device can be calculated by an easier process, so that the efficiency of a process by a computer can be increased.
In a fifteenth aspect based on the first aspect, the virtual camera setting means, when an object exists in a space to be displayed on the screen of the display device or the region in which the image of the virtual space is displayed on the screen, in the virtual space, determines the position and the angle of view of the virtual camera with reference to a position of the object.
Thus, according to the fifteenth aspect, the virtual camera can be placed, in the virtual space, at a position that is located the distance between the user and the television in the real space away from the position of the object. Thereby, a less unnatural image can be provided.
In the sixteenth aspect based on the first aspect, the virtual camera setting means, when a plurality of objects exist in a space to be displayed on the screen of the display device or the region in which the image of the virtual space is displayed on the screen, in the virtual space, determines the position and the angle of view of the virtual camera with reference to a position of an object closest to the virtual camera.
Thus, according to the sixteenth aspect, a less unnatural and highly realistic image can be displayed as if the virtual space actually existed immediately behind the screen of the display device.
A seventeenth aspect of certain example embodiments is directed to an image processing apparatus for outputting an image of a virtual space captured by a virtual camera to a display device (2) including a displayed region size obtaining means (10), a distance obtaining means (10), and a virtual camera setting means (10). The displayed region size obtaining means obtains displayed region size data indicating a size of a screen of the display device, or a size of a region in which the image of the virtual space is displayed on the screen. The distance obtaining means obtains distance data indicating a distance between a user and the display device. The virtual camera setting means sets a position and an angle of view of the virtual camera in the virtual space based on the displayed region size data and the distance data.
Thus, according to the seventeenth aspect, an effect similar to that of the first aspect can be obtained.
Thus, according to certain example embodiments, a less unnatural and highly realistic image of the virtual space as viewed from the user can be displayed, thereby making it possible to substantially prevent the user from feeling that something is wrong.
These and other objects, features, aspects and advantages of certain example embodiments will become more apparent from the following description when taken in conjunction with the accompanying drawings.